<%@page import="com.hhit.collaborative_learning.entity.QuestionPage"%>
<%@page import="com.hhit.collaborative_learning.dao.impl.PublicDaoImplMySql"%>
<%@page import="com.hhit.collaborative_learning.utils.Utils"%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ page isELIgnored="false"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
	String userId=Utils.getCookieValue("userId", request);
	String type=request.getParameter("type");
	type=type==null?"in":type;
	String currentPageStr=request.getParameter("currentPage");
	PublicDaoImplMySql dao=new PublicDaoImplMySql();
	QuestionPage QuestionPage=dao.getMyQuestion(type, Integer.parseInt(userId), currentPageStr);
	request.setAttribute("page", QuestionPage);
	request.setAttribute("type", type);
%>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="<%=basePath%>css/bootstrap.css" media="all"
	rel="stylesheet" />
<link href="<%=basePath%>css/avatar.css" media="all" rel="stylesheet" />
<link href="<%=basePath%>css/btn.css" media="all" rel="stylesheet" />
<link href="<%=basePath%>css/icon.css" media="all" rel="stylesheet" />
<link href="<%=basePath%>css/pagination.css" media="all"
	rel="stylesheet" />

<link href="<%=basePath%>css/index.css" media="all" rel="stylesheet" />

<link href="<%=basePath%>css/mini.css" media="all" rel="stylesheet" />
<link href="<%=basePath%>css/font-awesome.min.css" media="screen"
	rel="stylesheet" />
<!-- [if IE 7]-->
<link href="<%=basePath%>css/font-awesome-ie7.css" media="screen"
	rel="stylesheet" />
<!-- [endif]-->
<!--[if lte IE 7]>

    <!-- [if lt IE 9]-->
<script src="<%=basePath%>js/html5shiv.min.js"></script>
<script src="<%=basePath%>js/jquery-1.11.1.min.js"></script>
<script src="<%=basePath%>js/jquery.cookie.js"></script>
<script src="<%=basePath%>js/ask_init_digged.js"></script>
<!-- [endif]-->
<script type="text/javascript">
	//             var username = 'u013534446';
	//             var oper_username = 'u013534446';
	//             document.domain="csdn.net";
</script>

</head>
<body id='users-questions'>
	<script type="text/javascript">
	</script>
	<div class="main clearfix">
		<div style="margin-bottom: 10px;">
		</div>

		<div class="persional_property">
			<div class="second_nav_con">
				<dl class="second_nav">
					<dd class="">
						<a href="<%=basePath%>questions/questions.jsp" target="_top">全部问答</a>
					</dd>
					<dd class="active">
						<a href="myquestion.jsp" >我的问答</a>
					</dd>
					<dd class="">
						<a href="<%=basePath%>questions/askquestion.jsp">我要提问</a>
					</dd>
					<dd class="">
						<a href="<%=basePath%>questions/search.jsp?type=4" target="_blank">搜索</a>
					</dd>
				</dl>
			</div>
		</div>
		<link href="<%=basePath%>css/ask_my_question.css" media="screen"
			rel="stylesheet" />
		<link href="<%=basePath%>css/ask_index_A.css" media="screen"
			rel="stylesheet" />
		<div class="persion_section" style="margin-bottom: 30px;">

			<div class="common_con clearfix">
				<div class="questions_count">
					<p>
						
						<span <c:if test="${requestScope.type eq 'in'}">class="active"</c:if>> <a href="myquestion.jsp"> 我提出的<em>${requestScope.page.mysubmit }</em>
						</a>
						</span> <span <c:if test="${requestScope.type eq 'out'}">class="active"</c:if>> <a href="myquestion.jsp?type=out">
								我回答的<em>${requestScope.page.myanswer }</em>
						</a>
						</span>
					</p>
				</div>
				
				<c:forEach items="${requestScope.page.list }" var="question">
				<div class="questions_detail_con">
					<div class="q_time">
						<span>${question.questionTime }来自</span> <a class="user_name"
							href="javascript:void(0);" target="_blank">${question.questionUserName}</a>
						<c:if test="${question.questionPoint gt 0}">
						<b>悬赏 <a href="javascript:;" title="个人悬赏">${question.questionPoint}</a>
						</b>
							</c:if>
					</div>
					<dl>
						<dt>
							<a href="<%=basePath %>questions/questionDetail.jsp?questionId=${question.questionId}" target="_blank">${question.questionTitle}</a>
						</dt>
						<dd>${question.questionDesc}</dd>
					</dl>
					<div class="tags">
						<c:forEach items="${question.questionTag }" var="tag">
						<a href="javascript:void(0);" target="_blank">${tag}</a>
						</c:forEach>
					</div>
					<a 
					<c:choose>
						<c:when test="${question.state eq 0 }">
							title="暂无满意答案"
							class="answer_num"
						</c:when>
						<c:otherwise>
							title="已有满意答案"
							class="answer_num disable_color"
						</c:otherwise>
					</c:choose>
						 target="_blank"
						href="<%=basePath %>questions/questionDetail.jsp?questionId=${question.questionId}#answer_form"> <span>${question.questionAnswerNum }</span>
						<p>回答</p>
					</a>
				</div>
				<div class="share_bar_con">
					<div id="question_${question.questionId}_vote">
						<a class="approve" href="javascript:void(0);" rel="nofollow"
						qId="${question.questionId }" title="好问题，顶！" num="${question.questionDigged}">${question.questionDigged}</a>
					</div>

					<div id="question_181824">
						<span class="collection" style="margin-right: 15px;"> <a
							class="collection"
							href="javascript:void(0);"
							rel="nofollow" title="收藏"></a>
						</span>
					</div>
				</div>
				</c:forEach>
				<c:if test="${requestScope.page.totalPage gt 1}">
						<div class="page_nav" id="result_page">
								<span> ${requestScope.page.count}条数据
									共${requestScope.page.totalPage}页</span>
								<c:if test="${requestScope.page.currentPage>1}">
									<a href="myquestion.jsp?type=<%=type%>&currentPage=1">首页</a>
									<a
										href="myquestion.jsp?type=<%=type%>&currentPage=${requestScope.page.currentPage-1}">上一页</a>
								</c:if>
								<c:if test="${requestScope.page.pageDiffer>0}">
									<a
										href="myquestion.jsp?type=<%=type%>&currentPage=${requestScope.page.pageDiffer*5-4}">...</a>
								</c:if>

								<c:if
									test="${requestScope.page.pageDiffer*5+1<=requestScope.page.totalPage}">
									<c:choose>
										<c:when
											test="${requestScope.page.currentPage==requestScope.page.pageDiffer*5+1 }">
											<strong>${requestScope.page.pageDiffer*5+1}</strong>
										</c:when>
										<c:otherwise>
											<a
												href="myquestion.jsp?type=<%=type%>&currentPage=${requestScope.page.pageDiffer*5+1}">${requestScope.page.pageDiffer*5+1}</a>
										</c:otherwise>
									</c:choose>
								</c:if>

								<c:if
									test="${requestScope.page.pageDiffer*5+2<=requestScope.page.totalPage}">
									<c:choose>
										<c:when
											test="${requestScope.page.currentPage==requestScope.page.pageDiffer*5+2 }">
											<strong>${requestScope.page.pageDiffer*5+2}</strong>
										</c:when>
										<c:otherwise>
											<a
												href="myquestion.jsp?type=<%=type%>&currentPage=${requestScope.page.pageDiffer*5+2}">${requestScope.page.pageDiffer*5+2}</a>
										</c:otherwise>
									</c:choose>
								</c:if>

								<c:if
									test="${requestScope.page.pageDiffer*5+3<=requestScope.page.totalPage}">
									<c:choose>
										<c:when
											test="${requestScope.page.currentPage==requestScope.page.pageDiffer*5+3 }">
											<strong>${requestScope.page.pageDiffer*5+3}</strong>
										</c:when>
										<c:otherwise>
											<a
												href="myquestion.jsp?type=<%=type%>&currentPage=${requestScope.page.pageDiffer*5+3}">${requestScope.page.pageDiffer*5+3}</a>
										</c:otherwise>
									</c:choose>
								</c:if>

								<c:if
									test="${requestScope.page.pageDiffer*5+4<=requestScope.page.totalPage}">
									<c:choose>
										<c:when
											test="${requestScope.page.currentPage==requestScope.page.pageDiffer*5+4 }">
											<strong>${requestScope.page.pageDiffer*5+4}</strong>
										</c:when>
										<c:otherwise>
											<a
												href="myquestion.jsp?type=<%=type%>&currentPage=${requestScope.page.pageDiffer*5+4}">${requestScope.page.pageDiffer*5+4}</a>
										</c:otherwise>
									</c:choose>
								</c:if>

								<c:if
									test="${requestScope.page.pageDiffer*5+5<=requestScope.page.totalPage}">
									<c:choose>
										<c:when
											test="${requestScope.page.currentPage==requestScope.page.pageDiffer*5+5 }">
											<strong>${requestScope.page.pageDiffer*5+5}</strong>
										</c:when>
										<c:otherwise>
											<a
												href="myquestion.jsp?type=<%=type%>&currentPage=${requestScope.page.pageDiffer*5+5}">${requestScope.page.pageDiffer*5+5}</a>
										</c:otherwise>
									</c:choose>
								</c:if>
								<c:if
									test="${requestScope.page.totalPage>5 && requestScope.page.pageDiffer<requestScope.page.totalPage/5-1}">
									<a
										href="myquestion.jsp?type=<%=type%>&currentPage=${requestScope.page.pageDiffer*5+6}">...</a>
								</c:if>
								<c:if
									test="${requestScope.page.currentPage<requestScope.page.totalPage}">
									<a
										href="myquestion.jsp?type=<%=type%>&currentPage=${requestScope.page.currentPage+1}">下一页</a>
									<a
										href="myquestion.jsp?type=<%=type%>&currentPage=${requestScope.page.totalPage}">尾页</a>
								</c:if>
						</div>
					</c:if>
					<c:if test="${requestScope.page.count eq 0 }">
					<div class="no-mess icon-th-list"><span>该页面暂无内容</span></div></c:if>
			</div>
		</div>

	</div>
<style type="text/css">
.no-mess {
		color: #ccc;
		display: block;
		font-size: 16px;
		margin: 20px;
		text-align: center;
    }
.no-mess span {
  margin-left: 5px;
  font-family: 'Microsoft YaHei';
}
.page_nav {
	TEXT-ALIGN: center;
	PADDING-BOTTOM: 15px;
	PADDING-LEFT: 0px;
	PADDING-RIGHT: 0px;
	FONT: 12px/24px Arial;
	COLOR: #666;
	CLEAR: both;
	PADDING-TOP: 15px
}

.page_nav A {
	BORDER-BOTTOM: #dbe5ee 1px solid;
	BORDER-LEFT: #dbe5ee 1px solid;
	PADDING-BOTTOM: 0px;
	MARGIN: 0px 2px;
	PADDING-LEFT: 8px;
	PADDING-RIGHT: 8px;
	DISPLAY: inline-block;
	FONT: 12px/22px Arial, Helvetica, sans-serif;
	BACKGROUND: #fff;
	HEIGHT: 22px;
	COLOR: #333;
	BORDER-TOP: #dbe5ee 1px solid;
	CURSOR: pointer;
	BORDER-RIGHT: #dbe5ee 1px solid;
	PADDING-TOP: 0px;
	border-radius: 2px;
	-moz-border-radius: 2px;
	-webkit-border-radius: 2px;
	-khtml-border-radius: 2px
}

.page_nav STRONG {
	BORDER-BOTTOM: medium none;
	BORDER-LEFT: medium none;
	PADDING-BOTTOM: 0px;
	LINE-HEIGHT: 24px;
	MARGIN: 0px 3px;
	PADDING-LEFT: 8px;
	PADDING-RIGHT: 8px;
	DISPLAY: inline-block;
	BACKGROUND: #07519a;
	HEIGHT: 24px;
	COLOR: #fff;
	BORDER-TOP: medium none;
	FONT-WEIGHT: normal;
	BORDER-RIGHT: medium none;
	TEXT-DECORATION: none;
	PADDING-TOP: 0px;
	border-radius: 2px;
	-moz-border-radius: 2px;
	-webkit-border-radius: 2px;
	-khtml-border-radius: 2px
}

.page_nav A:hover {
	BORDER-BOTTOM: medium none;
	BORDER-LEFT: medium none;
	LINE-HEIGHT: 24px;
	MARGIN: 0px 3px;
	BACKGROUND: #07519a;
	HEIGHT: 24px;
	COLOR: #fff;
	BORDER-TOP: medium none;
	BORDER-RIGHT: medium none;
	TEXT-DECORATION: none
}

.page_nav A.select {
	CURSOR: default
}
</style>

	<div id="popup_mask" class="marker"></div>
	<div id="pop_win"
		style="position: absolute;background: none repeat scroll 0 0 #FFFFFF;z-index: 10000;border: 1px solid #DCDCDC;"></div>

	<script
		src="<%=basePath%>js/jquery.form.js"></script>


</body>
</html>

